package serialization

import (
	"github.com/bytedance/sonic"
)

// 使用 Sonic Json 执行序列化和反序列化
type Json struct{}

func (s Json) Marshal(object any) ([]byte, error) {
	stream, err := sonic.Marshal(object)
	return stream, err
}

func (s Json) Unmarshal(stream []byte, object any) error {
	err := sonic.Unmarshal(stream, object)
	return err
}
